package com.hinner.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@TableName("user")
public class User implements Serializable {

    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField("username")
    private String username;

    @TableField("real_name")
    private String realName;

    @TableField("password")
    private String password;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date updateTime;

    @TableLogic  //value是逻辑未删除，delval是逻辑删除值
    private Integer isDeleted;

    @TableField("email")
    private String email;

    @TableField("phone")
    private String phone;

    @TableField("avator")
    private String avator;

    @TableField("role")
    private String role="ROLE_USER"; // 默认是普通用户，管理员是ROLE_ADMIN

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private Date lastLoginTime;  //最后一次登录时间

    @TableField("isActived")
    private Integer isActived; //是否激活

    @TableField("company_id")
    private Integer companyId; //公司id

    @TableField(exist = false)
    private String companyName; //公司名称,不需要入库
}
